Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio: move from old MAME YM core to ymfm #141

Merged
merged 5 commits into from
Jul 19, 2023

Conversation

mooinglemur
Copy link
Contributor

The existing YM2151 core has a license that could potentially be problematic. ymfm is licensed under BSD, which is compatible with the rest of the project being under MIT.

This introduces a C++ lib into a C project. For now the glue interface replicates the old function calls so that the emu side didn't have to change how it called into the lib.

@mooinglemur
Copy link
Contributor Author

mooinglemur commented Jul 18, 2023

I don't think there are any technical barriers here, but since there might be philosophical arguments against adding a C++ lib into what is otherwise a pure C project. I want to ensure the top contributors are okay with this before it gets merged. @indigodarkwolf @stefan-b-jakobsson @jestin @irmen if you have any objections, please raise them.

x16-emulator is still a C project, and there is a functional interface (ymglue.cpp) that the C code will call to reach the YM2151 C++ code through a shim.

@stefan-b-jakobsson
Copy link
Collaborator

Personally I like to avoid C++, but if there is a great benefit I think we can use such a library.

@indigodarkwolf
Copy link
Contributor

I don't have any concerns about adopting C++ into x16emu, but I would take care to check that the ymfm library is outputting data at an appropriate sample rate for replacing the previous ym2151 code. Box16 needed to resample from the ymfm library's sample rate, which turned into an adventure. That said, all of Box16's contributions should be license-compatible with x16emu, so if needs be, things should be portable.

@mooinglemur
Copy link
Contributor Author

but I would take care to check that the ymfm library is outputting data at an appropriate sample rate for replacing the previous ym2151 code.

It looks like this is already the case. It appears ymfm is true chip emulation so it's that funky ~55.9KHz rate is coming out as x16emu is clocking the chip at 3.579545MHz. Natt's code already handles resampling and mixing with that expectation.

@irmen
Copy link
Contributor

irmen commented Jul 18, 2023

I remember box16 had some issues being able to be compiled on certain platforms when it upgraded to a newer C++ standard. I am FAR from an expert here, but I see in this makefile you set the c++ standard to c++17. Is this potentially problematic? Is it required? Can we select an older standard this library has to conform to, to avoid such issues?

@mooinglemur
Copy link
Contributor Author

I remember box16 had some issues being able to be compiled on certain platforms when it upgraded to a newer C++ standard. I am FAR from an expert here, but I see in this makefile you set the c++ standard to c++17. Is this potentially problematic? Is it required? Can we select an older standard this library has to conform to, to avoid such issues?

C++17 is what ymfm needs, according to its docs. I think Stephen was trying to use C++20 in Box16 which was probably a bit more bleeding edge at the time.

@mooinglemur mooinglemur marked this pull request as ready for review July 18, 2023 23:48
@tomxp411 tomxp411 merged commit d8b5dc4 into X16Community:master Jul 19, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants